import VueRouter from 'vue-router'
import routes from './components/constant-routes'



const router = new VueRouter({
  mode:"hash",
  routes
})



router.beforeEach((to, from, next)=>{
  if(to.path !== '/login'){
    if(!sessionStorage.getItem("token")){
      next({
        path: '/login'
      })
    }
  }
  next();
})
export default router